﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using YmSoft.Kblog.BLL;
using YmSoft.Kblog.Model;

namespace YmSoft.Kblog.Web.Handler
{
    /// <summary>
    /// GetServerTime 的摘要说明
    /// </summary>
    public class GetServerTime : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            context.Response.Write("{\"time\":\"" + time + "\",\"ip\":\""+context.Request.UserHostAddress+"\"}");
            LogManager log = new LogManager();
            log.SetLoginIP(context.Request.UserHostAddress, "登录记录");
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}